package com.crm.system.service.impl.customerManager;

import com.crm.model.entity.customerManager.SingleProductCustomerContact;
import com.crm.model.entity.sys.UserAccount;
import com.crm.service.customerManager.SingleProductCustomerContactDbService;
import com.crm.system.service.customerManager.SingleProductCustomerContactService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ Author ：pym
 * @ Date   ：2021/5/13 15:33
 */
@Service
public class SingleProductCustomerContactServiceImpl implements SingleProductCustomerContactService {
    @Autowired
    private SingleProductCustomerContactDbService singleProductCustomerContactDbService;

    /**
     * 单品客户-跟进-联系人回显
     * @Author pym
     * @Date  2021/5/13 15:37
     * @param status       -- 0 查询全部联系人和手机号 1 模糊搜索联系人和手机号
     * @param singleProductCustomerId   --单品客户id
     * @param contactName  --联系人姓名
     * @return {@link {java.util.List<com.crm.model.entity.customerManager.SingleProductCustomerContact>}}
     */
    @Override
    public List<SingleProductCustomerContact> selectSingleProductCustomerContacts(String status, String singleProductCustomerId, String contactName) {
        UserAccount userAccount = (UserAccount) SecurityUtils.getSubject().getPrincipal();//获取登录人信息
        return singleProductCustomerContactDbService.selectSingleProductCustomerContacts(singleProductCustomerId,"0".equals(status) ? "" : contactName,userAccount.getAccountId());
    }
}
